//
//  DataModel.m
//  ChengHuiTong
//
//  Created by ypwl on 15/11/5.
//  Copyright © 2015年 张文权. All rights reserved.
//

#import "DataModel.h"
#import <objc/runtime.h>
@implementation DataModel




-(instancetype)initWithDic:(NSDictionary *)dic{
    
    
    self = [super init];
    
    if (self) {
        
        
        [self setValuesForKeysWithDictionary:dic];
        
    }
    
    return self;
}

- (void)setValue:(id)value forUndefinedKey:(NSString *)key
{
    
}



- (NSDictionary*)dictionaryWithModel{
    
    NSMutableDictionary *dictionary = [NSMutableDictionary dictionary];
    for (NSString *key in [[self class] getAllKeys]) {
        
        id value = [self valueForKey:key];
        if (value != nil) {
            if ([value isKindOfClass:[NSArray class]]) {
                if ([value count]==0) {
                    continue;
                }
            }
            else if ([value isKindOfClass:[NSString class]]) {
                if ([value length]==0) {
                    continue;
                }
            }
            [dictionary setValue:value forKey:key];
        }else {
            continue;
        }
    }
    return dictionary;
}

+ (NSArray *)getAllKeys {
    
    NSMutableArray *props = [NSMutableArray array];
    unsigned int outCount, i;
    objc_property_t *properties = class_copyPropertyList([self class], &outCount);
    
    for (i = 0; i < outCount; i++) {
        
        const char *char_f =property_getName(properties[i]);
        NSString *propertyName = [NSString stringWithUTF8String:char_f];
        [props addObject:propertyName];
    }
    
    free(properties);
    return props;
}





@end


#pragma mark 推荐页

@implementation RecommendModel

-(instancetype)initWithDic:(NSDictionary *)dic{
    
    self = [super init];
    if (self) {
        
              
     [self setValuesForKeysWithDictionary:dic];
        
    }
    return self;
}

- (void)setValue:(id)value forUndefinedKey:(NSString *)key
{
    
}


@end

@implementation ZQListModel

-(instancetype)initWithDic:(NSDictionary *)dic{
    
    self = [super init];
    if (self) {
        
        
        [self setValuesForKeysWithDictionary:dic];
        
    }
    return self;
}

- (void)setValue:(id)value forUndefinedKey:(NSString *)key
{
    self.tid = value;
}

@end


#pragma 账户详情

@implementation AccountDetails

-(instancetype)initWithDic:(NSDictionary *)dic{
    
    self = [super init];
    if (self) {
        
        
        
        [self setValuesForKeysWithDictionary:dic];
        
    }
    return self;
}

- (void)setValue:(id)value forUndefinedKey:(NSString *)key
{
    
}


@end


#pragma mark 回款计划

@implementation PayBackModel

-(instancetype)initWithDic:(NSDictionary *)dic{
    
    self = [super init];
    
    if (self) {
        
        
        [self setValuesForKeysWithDictionary:dic];
        
    }
    return self;
}

- (void)setValue:(id)value forUndefinedKey:(NSString *)key
{
    
}



@end


@implementation tenderRecoring

-(instancetype)initWithDic:(NSDictionary *)dic{
    
    self = [super init];
    
    if (self) {
        
        
        [self setValuesForKeysWithDictionary:dic];
        
    }
    
    return self;
}

- (void)setValue:(id)value forUndefinedKey:(NSString *)key
{
    
}



@end

@implementation MyReturnDetail

-(instancetype)initWithDic:(NSDictionary *)dic{
    
    self = [super init];
    if (self) {
        
        
        [self setValuesForKeysWithDictionary:dic];
        
    }
    return self;
}

- (void)setValue:(id)value forUndefinedKey:(NSString *)key
{
    
}

@end

@implementation VipModel

-(instancetype)initWithDic:(NSDictionary *)dic{
    
    
    self = [super init];
    
    if (self) {
        
        
        [self setValuesForKeysWithDictionary:dic];
        
    }
    
    return self;
}

- (void)setValue:(id)value forUndefinedKey:(NSString *)key
{
    
}


@end


@implementation RedbagModel


- (void)setValue:(id)value forUndefinedKey:(NSString *)key
{
    
}
@end



@implementation newUserBid

@end


@implementation autoListModel

@end

@implementation CouponModel

@end



